package com.ruoyi.supply.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.supply.mapper.SupplyMapper;
import com.ruoyi.supply.domain.Supply;
import com.ruoyi.supply.service.ISupplyService;
import com.ruoyi.common.core.text.Convert;

/**
 * 供货Service业务层处理
 * 
 * @author yyg
 * @date 2023-11-27
 */
@Service
public class SupplyServiceImpl implements ISupplyService 
{
    @Autowired
    private SupplyMapper supplyMapper;

    /**
     * 查询供货
     * 
     * @param goodsId 供货主键
     * @return 供货
     */
    @Override
    public Supply selectSupplyByGoodsId(Long goodsId)
    {
        return supplyMapper.selectSupplyByGoodsId(goodsId);
    }

    /**
     * 查询供货列表
     * 
     * @param supply 供货
     * @return 供货
     */
    @Override
    public List<Supply> selectSupplyList(Supply supply)
    {
        return supplyMapper.selectSupplyList(supply);
    }

    /**
     * 新增供货
     * 
     * @param supply 供货
     * @return 结果
     */
    @Override
    public int insertSupply(Supply supply)
    {
        return supplyMapper.insertSupply(supply);
    }

    /**
     * 修改供货
     * 
     * @param supply 供货
     * @return 结果
     */
    @Override
    public int updateSupply(Supply supply)
    {
        supply.setUpdateTime(DateUtils.getNowDate());
        return supplyMapper.updateSupply(supply);
    }

    /**
     * 批量删除供货
     * 
     * @param goodsIds 需要删除的供货主键
     * @return 结果
     */
    @Override
    public int deleteSupplyByGoodsIds(String goodsIds)
    {
        return supplyMapper.deleteSupplyByGoodsIds(Convert.toStrArray(goodsIds));
    }

    /**
     * 删除供货信息
     * 
     * @param goodsId 供货主键
     * @return 结果
     */
    @Override
    public int deleteSupplyByGoodsId(Long goodsId)
    {
        return supplyMapper.deleteSupplyByGoodsId(goodsId);
    }
}
